<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
.text{width:300px;height:auto; background:#eee;padding:10px;}
p{border-bottom:1px dotted red;}
</style>
<script src="../pengxuan.js"></script>
<script>
window.onload=function(){
	var inputs=document.getElementsByTagName('input')[0];
	var textarea=document.getElementsByTagName('textarea')[0];
	var text=getClass('text')[0];
	document.onkeydown=inputs.onclick=function(e){
		var ev=e||event;	
		var con=textarea.value;
		if(ev.type=='click'){
			var ps=document.createElement('p');
			ps.innerHTML=con;
			text.appendChild(ps)	
		};
		
		if(ev.type=='keydown'){
			if(ev.keyCode==13){
				if(ev.ctrlKey){
					var ps=document.createElement('p');
					ps.innerHTML=con;
					text.appendChild(ps)			
				};	
			}	
		}
	};	
};
</script>
</head>

<body>
<div class="text">
	<p>这是第一条留言</p>
</div>
<textarea>

</textarea>
<input type="button" value="提交" />
</body>
</html>
